package com.atguigui.leetcode;

/**
 * 1684.统计一致字符串的数目
 * Project: leetcode
 * Package: com.atguigui.leetcode
 * Version: 1.0
 * <p>
 * Created by WJX on 2022/11/8 9:05
 */
public class P1684CountTheNumberOfConsistentStrings {

    public static void main(String[] args) {
        Solution solution = new P1684CountTheNumberOfConsistentStrings().new Solution();
        // TO TEST
    }

    class Solution {
        public int countConsistentStrings(String allowed, String[] words) {

            int ans = 0;
            for (String word : words) {
                boolean flag = false;

                for (int i = 0; i < word.length(); i++) {
                    if (!allowed.contains(word.substring(i, i + 1))) {
                        flag = true;
                        break;
                    }
                }
                if (flag) continue;
                ans++;
            }

            return ans;
        }
    }
}
